package easyway.trainapp.webframework.web;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
/**
 * 
 * @author zhangqihang
 * ShuttleList转换器
 *
 */



public class ShuttleListConverter implements javax.faces.convert.Converter{

	public Object getAsObject(FacesContext context, UIComponent component,
			String value) {

		int index = value.indexOf(':');
		
		return new ShuttleListMenu(value.substring(0, index), value.substring(index + 1));
	}

	public String getAsString(FacesContext context, UIComponent component,
			Object value) {

		ShuttleListMenu menuItem = (ShuttleListMenu) value;
		return menuItem.getIconImage()+":"+menuItem.getName();
	}

}